Adding tags to Widgets
This documentation will guide you in tracking your views.
To display In-App Nudges
or In-Line Widgets
(such as Banners or Stories) in your app, you need to track views. By doing so, you can dynamically control the content of these elements directly from Nudge's Dashboard.
info
All tags accross your app should be unique
SwiftUI
The below snippet shows how you can set tag to your SwiftUI
view.
Text("Play Now!")
.padding()
.background(Color.black)
.foregroundColor(.white)
.cornerRadius(8)
.widgetTracker("play_now_btn", opacity: 1)
UIKit
The below snippet shows how you can set tag to your UIKit
view.
let imageView = UIImageView(image: UIImage(named: "heroHeader"))
imageView.frame = CGRect(x: 0, y: 200, width: 200, height: 200)
imageView.widgetTracker = "hero"
self.view.addSubview(imageView)